Experiments with Generic Visitors

نویسندگان

  • Jens Palsberg
  • C. Barry Jay
  • J. Noble
چکیده

This paper gives an overview of our work on generic visitors 12], and it gives a comparison of two implementations, in Java and Smalltalk. For object-oriented programming, the Visitor pattern 3] enables the deeni-tion of a new operation on an object structure without changing the classes of the objects. The discovery of generic visitors is due to striking parallels with shape polymorphic 5], or polytypic 4, 10] programming. This illustrates the connections among the various programming styles. The standard way of creating a new operation on an object is to create a new method for it by editing and recompiling its class. It often happens that new methods in many classes must be created to support what is conceptually a single action, such as a search for a particular eld in a particular class of objects. This is rather tedious. Analogous problems arise in functional programming where the standard pattern-matching approach means that an operation like mapping of a function must be redeened for each new data type. The Visitor pattern provides an alternative means of creating new operations without changing any classes. The operation is decomposed into a description of how to determine the class of an object, and the actions to be taken when the class is found. The former need only be speciied by, once and for all, inserting accept methods into the class deenitions, while the latter vary from visitor to visitor 13]. The analogy with mapping becomes clearer, as the visitor corresponds to the function being mapped, whose application is controlled by the class. The analogous functional approach is captured in PolyP 4] which improves on the earlier work in Charity 2]. The compiler determines the type, and uses this information to specialise the map algorithm automatically. The functional approach is a little smoother here, because the limited set of combinators used all have standard deenitions, so that there is no need to supply explicit accept methods. A generic visitor, or walkabout, does away with the need for accept methods, so that there is no need to change the classes at all. This is achieved by using reeection to determine the elds of an object at run-time, and then visiting them all unless explicitly diverted by the visitor. Here the analogy was put to work, explicitly transferring ideas from the functional setting. A shape polymorphic map function was proposed in 7] and implemented in Functorial …

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An Agent-Based Architecture for Museum Visitors' Guide Systems

Recent developments in museum visitors' guides focus on context awareness, personalization and multimodal and multimedia information presentation to individuals and groups of visitors. However, the modern museum is becoming an "Active Museum", which is a special example of an active environment that interacts with its inhabitants. Since recent museum visitors' guides have focused more on the ap...

متن کامل

Non - crisp Clustering Web Visitors by Fast , Convergent and Robust Algorithms on

The algorithms proposed to date for categorizing WEB-visitors are all of quadratic time complexity (they essentially require computing the dissimilarity between all pairs of paths). These clustering eeorts, although not scalable, have demonstrated the extensive beneets and sophisticated applications emerging from identifying groups of visitors to a web site. We provide a sub-quadratic clusterin...

متن کامل

Using QR codes to increase user engagement in museum-like spaces

Quick Response (QR) code technologies offer potentially outstanding opportunities to transform public experience in museum-like spaces. However, although QR codes are a cost-effective way of delivering digital information in these spaces, there is as yet little information on the resulting effects on visitor engagement. We conducted two different controlled experiments in order to examine the e...

متن کامل

Vision-based production of personalized video

In this paper we present a novel vision-based system for the automated production of personalised video souvenirs for visitors in leisure and cultural heritage venues. Visitors are visually identified and tracked through a camera network. The system produces a personalized DVD souvenir at the end of a visitor’s stay allowing visitors to relive their experiences. We analyze how we identify visit...

متن کامل

A research C# compiler

C# is the new flagship language in the Microsoft .NET platform. C# is an attractive vehicle for language design research not only because it shares many characteristics with Java, the current language of choice for such research, but also because it’s likely to see wide use. Language research needs a large investment in infrastructure, even for relatively small studies. This paper describes a n...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2007